! ******************************
finish
/clear
/units,si 
/filn,E432
/title, mechanical stress analysis of fixed tube-sheet exchanger
! ***************β趨***************
*SET,tshell,17          !ǳͲں
*SET,hshell,2500        
!ǳͲһԣؿܰʱԳԽģҿǳ̷ӦΪǳܳȵһ롣
*SET,dshell,806         !ǳͲھ
*SET,hpsh,20            !ǳ̲ܰ͹߶
*SET,rshell,15          !ǳ̲ܰԲǰ뾶
*SET,shigh,100          !ܰ
*SET,tchannel,18.5      !ܳͲں
*SET,hchannel,350       !ܳͲ
*SET,hpch,20            !̲ܳܰ͹߶
*SET,rchannel,15        !̲ܳܰԲǰ뾶
*SET,dp,25              !ȹֱ
*SET,sp,38              !ȹܹܼ
*SET,tpipe,2.5          !ȹܱں
*SET,tinsulat,50        !²
*SET,ny,20              !ȹ
*DIM,nxz,,ny            !һάÿдŸлȹܸ
*SET,nxz(1),6,6,6,6,5,6,5,6,5,5
*SET,nxz(11),5,5,4,5,4,4,3,3,2,1
! ***************ʷֲ趨***************
*SET,ngh,8              !ȹʷ
*SET,ngmesh,40          !ȹʷ
*SET,densitymeshg,2     !ȹʷּܱ
*SET,nr0,60             !ܰ廷ʷ
*SET,nhou,2             !ǳ̺͹ܳͲںʷ
*SET,ninsulat,3         !²ںʷ
*SET,nhshell,40         !ǳͲʷ
*SET,nchannel,8         !ܳͲʷ
*SET,nr,4               !ܰԲʷ
*SET,nshigh,4           !ܰʷ
*SET,nhpsh,2            !ǳ̲ܰ͹߶ʷ
*SET,nhpch,2            !̲ܳܰ͹߶ʷ
! ***************غ***************
*SET,ps,0.58            !ǳѹ
*SET,pt,2               !ܳѹ
! ***************ǰ***************
/prep7
et,1,shell63            !帨ģĿǵԪ
et,2,solid45            !Ӧ嵥Ԫ
mp,ex,1,2.1e5           !ϵĵģ,1Ų϶ӦͲְ
mp,nuxy,1,0.3           !ϵĲɱ
mp,ex,2,202780          !ϵĵģ,2Ų϶Ӧְ
mp,nuxy,2,0.3           !ϵĲɱ
mp,ex,3,2e5             !ϵĵģ,3Ų϶Ӧܰͼ
mp,nuxy,3,0.3           !ϵĲɱ
mp,ex,4,93710           !ϵĵģ,4Ų϶Ӧȹֹܸ
mp,nuxy,4,0.3           !ϵĲɱ
! ***************ģ***************
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ܰ±,ķ֮һ
*if,dshell/2.0d0-rshell,le,dshell/2.0d0+tshell-tchannel-rchannel,then !жϲȷһܰԲƽ뾶ԲǱԵСΪ5mm
rol=dshell/2.0d0-rshell-5
*else
rol=dshell/2.0d0+tshell-tchannel-rchannel-5
*endif
pcirc,,rol,,90          !ɹܰԲƽ棬Ϊ1
*afun,deg               !תɽǶ
ntol=0                  !ȹ
*do,j,1,ny              !ѭԻȹֱΪֱԲƽ
ntemp=j
*do,i,1,nxz(ntemp)
*if,ntemp,ne,nint(ntemp/2)*2,then                     !ݵǰȹżȷƫƵԲ
wpoffs,sp*sin(60)+2*sp*sin(60)*(i-1),sp*(j-1)*cos(60) !jΪʱеiȹԲ
*else
wpoffs,2*sp*sin(60)*(i-1),sp*(j-1)*cos(60)            !jΪżʱеiȹԲ
*endif
pcirc,,dp/2.0d0         !ԻȹֱΪֱԲƽ
ntol=ntol+1             !1
wpcsys,1,0              !Բ
*enddo
*enddo
asel,u,area,,1          !ѡгܰԲƽ
cm,base1,area           !һѡеԻȹֱΪֱԲƽΪbase1
allsel                  !ȫѡ
asba,1,base1            !㣬ܰ±
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ȹ±,ķ֮һ
*do,j,1,ny              !ѭȹ±Բ棬һѭͬ
ntempj=j
*do,i,1,nxz(ntempj)
ntempi=i
*if,ntempj,ne,nint(ntempj/2)*2,then
wpoffs,sp*sin(60)+2*sp*sin(60)*(i-1),sp*(j-1)*cos(60)
*else
wpoffs,2*sp*sin(60)*(i-1),sp*(j-1)*cos(60)
*endif
*if,ntempj,eq,1,then
pcirc,dp/2.0d0-tpipe,dp/2.0d0,,90
pcirc,dp/2.0d0-tpipe,dp/2.0d0,90,180
*else
*if,ntempj,eq,nint(ntempj/2)*2,then
*if,ntempi,eq,1,then
pcirc,dp/2.0d0-tpipe,dp/2.0d0,270,360
pcirc,dp/2.0d0-tpipe,dp/2.0d0,,90
*else
pcirc,dp/2.0d0-tpipe,dp/2.0d0 
*endif
*else
pcirc,dp/2.0d0-tpipe,dp/2.0d0 
*endif
*endif
wpcsys,1,0
*enddo
*enddo
aglue,all               !²ĻȹԲܰƽճΪһ
numcmp,area             !ʹŴС
numcmp,line             !ʹߵߺŴС
lsel,s,radius,,rol      !ѡйܰԲƽԵ
asll,s,0                !ѡص棬ܰ±
cm,basplt,area          !ܰ±Ϊbasplt
allsel                  !ȫѡ
asel,u,area,,basplt     !ѡлȹ±Բ
cm,bastub,area          !ȹ±ԲΪbastub
allsel                  !ȫѡ
!!!!!!!!!!!!!!!!!!!ʷֲ
lsel,s,radius,,rol      !ѡйܰԲƽԵ
lesize,all,,,nr0        !ָߵʷ
allsel                  !ȫѡ
lsel,s,radius,,dp/2.0d0-tpipe,dp/2.0d0  !ѡйɻȹ±ԲԲ
lesize,all,,,ngh/4      !ָЩߵʷ
allsel                  !ȫѡ
lsel,s,length,,tpipe    !ѡгΪȹܱں
lesize,all,,,1          !ȹܱںʷ1
allsel                  !ȫѡ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ܰ
mshape,0,2d             !ָ浥Ԫ״Ϊı
type,1                  !ָ浥Ԫ
esize,sp-dp             !嵥Ԫߴ
mat,3                   !趨
amesh,basplt            !Բܰ±񻮷
k,10001,0,0,0           !첼ܰ±Ĺؼ
k,10002,0,0,tchannel    !첼ܰ±Ĺؼ
k,10003,0,0,shigh-tshell!첼ܰ±Ĺؼ
k,10004,0,0,shigh       !첼ܰ±Ĺؼ
numcmp,line             !ʹߵߺŴС
l,10001,10002,nhou      !ɲܰ±츨ߣָʷ
l,10002,10003,nshigh    !ɲܰ±츨ߣָʷ
l,10003,10004,nhou      !ɲܰ±츨ߣָʷ
*get,line0,line,,num,max!õߵߺ
type,2                  !ָ嵥Ԫ
vdrag,basplt,,,,,,line0-2,line0-1,line0 !ܰ嵥Ԫ
aclear,basplt           !ܰ±浥Ԫ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ȹ
mshape,0,2d             !ָ浥Ԫ״Ϊı
type,1                  !ָ浥Ԫ
mat,4                   !趨
amesh,bastub            !Իȹ±Բ񻮷
k,10005,0,0,shigh+rshell+hpsh+hshell !컻ȹ±ԲĹؼ
l,10004,10005           !ɻȹ±Բ츨
*get,line1,line,,num,max!õߵߺ
lesize,line1,,,ngmesh,densitymeshg  !ָʷַͼܱ
type,2                  !ָ嵥Ԫ
vdrag,bastub,,,,,,line0-2,line0-1,line0,line1 !ȹܵ嵥Ԫ
aclear,bastub           !ȹ±Բ浥Ԫ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ܳͲ
wprota,,90              !ת
numcmp,area             !ʹŴС
*get,narea1,area,,num,max                    !õǰ
rectang,dshell/2.0d0+tshell-tchannel,dshell/2.0d0+tshell,-(rchannel+hpch+hchannel),-(rchannel+hpch) !ɹܳͲ
lsel,s,loc,z,-(rchannel+hpch+hchannel/2.0d0) !ѡ߶
lesize,all,,,nchannel                        !ָ߶ʷ
allsel                                       !ȫѡ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ܰǳͲ͹ܳͲ
rectang,dshell/2.0d0+tshell-tchannel,dshell/2.0d0+tshell,-(rchannel+hpch),-rchannel  !ɹ̲ܰܳ͹
lsel,s,loc,z,-(rchannel+hpch/2.0d0)          !ѡ߶
lesize,all,,,nhpch                           !ָ߶ʷ
allsel                                       !ȫѡ
numcmp,line                                                !ʹߵߺŴС
*get,line2,line,,num,max                                   !õǰߺ
k,200001,dshell/2.0d0+tshell-tchannel-rchannel,0,-rchannel !̲ܰܳԲԲ
k,400001,dshell/2.0d0-rshell,,shigh+rshell
k,300001,dshell/2.0d0+tshell-tchannel,0,-rchannel          !̲ܰܳԲǻ
k,300002,dshell/2.0d0+tshell-tchannel-rchannel+rchannel*cos(45),,-rchannel+rchannel*cos(45)!̲ܰܳԲǻе
k,300003,dshell/2.0d0+tshell-tchannel-rchannel,,,          !̲ܰܳԲǻյ
k,300004,rol,,,                              !γɴĹؼ
k,300005,rol,,tchannel                       !γɴĹؼ
k,300006,rol,,shigh-tshell                   !γɴĹؼ
k,300007,rol,,shigh                          !γɴĹؼ
k,300008,dshell/2.0d0-rshell,,shigh          !γɴĹؼ
k,300009,dshell/2.0d0-rshell+rshell*cos(45),,shigh+(rshell-rshell*cos(45)) !γɴĹؼ
k,300010,dshell/2.0d0,,shigh+rshell          !γɴĹؼ
k,300011,dshell/2.0d0+tshell,,shigh+rshell   !γɴĹؼ
k,300012,dshell/2.0d0+tshell,,shigh-tshell   !γɴĹؼ
k,300013,dshell/2.0d0+tshell,,tchannel       !γɴĹؼ
k,300014,dshell/2.0d0+tshell,,-rchannel      !γɴĹؼ
k,300015,dshell/2.0d0+tshell-tchannel-rchannel,,tchannel !γɴĹؼ
k,300016,dshell/2.0d0-tshell,,shigh-tshell   !γɴĹؼ
larc,300001,300002,200001,rchannel           !ɴԵline2+1
lesize,line2+1,,,nr/2                        !ָʷ
l,300001,300014,nhou                         !񻮷ָline2+2
l,300002,300013,nhou                         !񻮷ָline2+3
l,300013,300014,nr/2                         !ɴԵline2+4
al,line2+1,line2+2,line2+3,line2+4           !ɴ
larc,300002,300003,200001,rchannel           !ɴԵline2+5
lesize,line2+5,,,nr/2                        !ָʷ
l,300003,300015,nhou                         !񻮷ָline2+6
l,300013,300015,nr/2                         !񻮷ָline2+7
al,line2+3,line2+5,line2+6,line2+7           !ɴ
l,300003,300004,1                            !ɴԵline2+8
l,300004,300005,nhou                         !񻮷ָline2+9
l,300005,300006,nshigh                       !񻮷ָline2+10
l,300006,300007,nhou                         !񻮷ָline2+11
l,300007,300008,1                            !ɴԵline2+12
l,300008,300016,nhou                         !񻮷ָline2+13
l,300016,300015,nshigh                       !񻮷ָline2+14
al,line2+6,line2+8,line2+9,line2+10,line2+11,line2+12,line2+13,line2+14 !ɴ
l,300012,300016,nr/2                         !񻮷ָline2+15
l,300012,300013,nshigh                       !ɴԵline2+16
al,line2+7,line2+14,line2+15,line2+16        !ɴ
l,300009,300012,nhou                         !񻮷ָline2+17
larc,300008,300009,400001,rshell             !ɴԵline2+18
lesize,line2+18,,,nr/2                       !ָʷ
al,line2+13,line2+15,line2+17,line2+18       !ɴ
larc,300009,300010,400001,rshell             !ɴԵline2+19
lesize,line2+19,,,nr/2                       !ָʷ
l,300010,300011,nhou                         !񻮷ָline2+20
l,300011,300012,nr/2                         !ɴԵline2+21
al,line2+17,line2+19,line2+20,line2+21       !ɴ
rectang,dshell/2.0d0,dshell/2.0d0+tshell,shigh+rshell,shigh+rshell+hpsh !ɹ̲ܰܳ͹
lsel,s,loc,z,shigh+rshell+hpch/2.0d0         !ѡ߶
lesize,all,,,nhpsh                           !ָ߶ʷ
allsel                                       !ȫѡ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ǳͲ
rectang,dshell/2.0d0,dshell/2.0d0+tshell,shigh+rshell+hpsh,shigh+rshell+hpsh+hshell
lsel,s,loc,z,shigh+rshell+hpch+hshell/2.0d0     !ѡ߶
lesize,all,,,nhshell                            !ָ߶ʷ
allsel                                          !ȫѡ
lsel,s,loc,x,dshell/2.0d0+tshell-tchannel/2.0d0 !ѡ߶
lesize,all,,,nhou                            !ָ߶ʷ
allsel                                       !ȫѡ
lsel,s,loc,x,dshell/2.0d0+tshell/2.0d0       !ѡ߶
lesize,all,,,nhou                            !ָ߶ʷ
allsel                                       !ȫѡ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mshape,0,2d                                  !ָ浥Ԫ״Ϊı
type,1                                       !ָ浥Ԫ
mat,2                                        !趨
amesh,narea1+1                               !Թ񻮷
type,2                                       !ָ嵥Ԫ
esize,,nr0                                   !嵥Ԫߴ
vrotat,narea1+1,,,,,,10001,10002,90,1        !嵥Ԫ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ܰ
mshape,2,2d                                  !ָ浥Ԫ״Ϊı
type,1                                       !ָ浥Ԫ
mat,3                                        !趨
amesh,narea1+2,narea1+9                      !Թܰ񻮷
esize,,nr0                                   !嵥Ԫߴ
vrotat,narea1+2,narea1+3,narea1+4,narea1+5,,,10001,10002,90,1 !ܰ嵥Ԫ
vrotat,narea1+6,narea1+7,narea1+8,narea1+9,,,10001,10002,90,1 !ܰ嵥Ԫ
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Ͳ
mshape,2,2d                                  !ָ浥Ԫ״Ϊı
type,1                                       !ָ浥Ԫ
mat,1                                        !趨
amesh,narea1+10                              !Ͳ񻮷
esize,,nr0                                   !嵥Ԫߴ
vrotat,narea1+10,,,,,,10001,10002,90,1       !Ͳ嵥Ԫ
aclear,narea1+1,narea1+10,1                  !浥Ԫ
nummrg,all                                   !غϵĵ㡢ߡϢϲ
numcmp,all                                   !е㡢ߡϢ
finish
! ******************************
/solu
nsel,s,loc,z,shigh+rshell+hpsh+hshell        !ѡ
d,all,uz,0                                   !Լ
allsel                                       !ȫѡ
nsel,s,loc,x,0                               !ѡ
d,all,ux,0                                   !Լ
allsel                                       !ȫѡ
nsel,s,loc,y,0                               !ѡ
d,all,uy,0                                   !Լ
allsel                                       !ȫѡ
lsel,s,radius,,dshell/2.0d0                  !ѡ
lsel,a,radius,,dshell/2.0d0-rshell           !ѡ
lsel,a,radius,,rol                           !ѡ
lsel,u,loc,z,-rchannel-hpch-hchannel,shigh-tshell !ɾ
asll,s,0                                     !ѡص
asel,u,loc,z,shigh-tshell/2.0d0              !ɾ
asel,u,loc,z,shigh+rshell                    !ɾ
asel,u,loc,z,shigh+rshell+hpsh               !ɾ
asel,u,loc,z,shigh+rshell+hpsh+hshell        !ɾ
sfa,all,,pres,ps                             !Թܰϱʩѹغ
allsel                                       !ȫѡ
lsel,s,radius,,dp/2.0d0                      !ѡ
lsel,r,loc,z,shigh+rshell+hpsh+hshell        !ѡ
asll,s,0                                     !ѡص
asel,u,loc,z,shigh+rshell+hpsh+hshell        !ɾ
sfa,all,,pres,ps                             !Իȹʩѹغ
allsel                                       !ȫѡ
lsel,s,radius,,dp/2.0d0-tpipe                !ѡ
asll,s,0                                     !ѡص
lsel,all                                     !ѡ߶
lsel,s,radius,,dp/2.0d0                      !ѡ
asll,u,0                                     !ѡص
sfa,all,,pres,pt                             !Իȹڱʩѹغ
allsel                                       !ȫѡ
lsel,s,radius,,dshell/2.0d0+tshell-tchannel  !ѡ
lsel,a,radius,,dshell/2.0d0+tshell-tchannel-rchannel !ѡ
lsel,a,radius,,rol                           !ѡ
lsel,u,loc,z,tchannel,shigh+rshell+hpsh+hshell !ɾ
asll,s,0                                     !ѡص
asel,u,loc,z,tchannel/2.0d0                  !ɾ
asel,u,loc,z,-rchannel                       !ɾ
asel,u,loc,z,-rchannel-hpch                  !ɾ
asel,u,loc,z,-rchannel-hpch-hchannel         !ɾ
sfa,all,,pres,pt                             !Թܰ±͹ڱʩѹغ
allsel                                       !ȫѡ
lsel,s,radius,,dp/2.0d0-tpipe                !ѡ
lsel,r,loc,z,0                               !ѡ
asll,s,0                                     !ѡص
asel,u,loc,z,tchannel/2.0d0                  !ɾ
sfa,all,,pres,pt                             !Իȹ±ʩѹغ
allsel                                       !ȫѡ
*SET,pn,(dshell/2.0d0+tshell-tchannel)**2*pt/((dshell/2.0d0+tshell)**2-(dshell/2.0+tshell-tchannel)**2)   !ƽ
asel,s,loc,z,-rchannel-hpch-hchannel         !ѡ
sfa,all,,pres,-pn                            !ʩƽ
allsel
solve                                        !
finish
! ******************************
/post1
plnsol,s,int,0,1     	                     !Ӧǿͼ
! ***************Ӧ·1--1***************
*SET,firpot,27934                            !ڱڽڵ
*SET,secpot,27932                            !ڽڵ
path,L1,2                                    !·Ƽ·
ppath,1,firpot                               !·
ppath,2,secpot                               !·յ
prsect, ,0                                   !г·Ի
! ***************Ӧ·2--2***************
*SET,firpot,27972                            !ڱڽڵ
*SET,secpot,27968                            !ڽڵ
path,L2,2                                    !·Ƽ·
ppath,1,firpot                               !·
ppath,2,secpot                               !·յ
prsect, ,0                                   !г·Ի
! ***************Ӧ·3--3***************
*SET,firpot,121                              !ڱڽڵ
*SET,secpot,7471                             !ڽڵ
path,L3,2                                    !·Ƽ·
ppath,1,firpot                               !·
ppath,2,secpot                               !·յ
prsect, ,0                                   !г·Ի
finish
